<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跳动的心</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
        }

        body {
            background-color: pink;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
        }

        .heart {
            width: 100px;
            height: 100px;
            background-color: red;
            position: relative;
            transform: rotate(45deg);
            /* 翻转45度 */
            animation: heartbit 1s infinite alternate;
            /* 开启css动画 animation: 动画名称 持续时间 循环次数 播放方向 */
            box-shadow: 0 0 30px red;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
        }

        /* 设置伪元素.heart::after */
        .heart::after {
            content: "";
            width: 100px;
            height: 50px;
            background-color: red;
            border-radius: 100px 100px 0 0;
            position: absolute;
            left: 0;
            top: -49px;
            box-shadow: 0 0 30px red;
        }

        /* 设置伪元素.heart::before */
        .heart::before {
            content: "";
            width: 50px;
            height: 100px;
            background-color: red;
            position: absolute;
            top: 0;
            left: -49px;
            border-radius: 100px 0 0 100px;
            box-shadow: 0 0 30px red;
        }

        /* 若让盒子中的子集在盒子中居中，需要在父盒子上添加属性
       display: flex;
       justify-content: center;
       flex-direction: row;
       align-items: center;
        */
        .heart p {
            color: white;
            font-size: 24px;
            transform: rotate(-45deg);
        }

        /* 实现动画，让心跳动起来 */
        @keyframes heartbit {
            0% {
                transform: rotate(45deg) scale(0.6);
                /* 翻转45度 缩放原来的0.6倍 */
            }

            100% {
                transform: rotate(45deg) scale(1.6);
            }
        }
    </style>
</head>

<body>
    <div class="heart">
        <p>心动</p>
    </div>
</body>

</html>